package router

import (
	"video_html/services"

	"github.com/gin-gonic/gin"
)

func SetupRouters() *gin.Engine {
	r := gin.Default()
	r.Static("/static", "./static")
	r.Static("/v1/videos/static/", "./static")
	r.LoadHTMLGlob("templates/*")
	noAuth := r.Group("/v1")
	auth := r.Group("/v1")
	auth.Use(services.CheckToken())
	r.GET("/", services.Getindex)
	noAuth.GET("/login", services.GETLoginHTML)
	noAuth.GET("/register", services.GETRegisterPostHTML)
	auth.GET("/videos/detail/:int", services.Video)
	auth.GET("/personal", services.PersonInfo)
	noAuth.GET("/haha",services.GetHaha)
	noAuth.GET("/navbar",services.Navbar)
	return r
}
